#ifndef _TCPSERVER_H_
#define _TCPSERVER_H_
//
#include <windows.h>
#include <winsock2.h>
#include "ITCPHandler.h"
//
class TCPServer {
public:
	TCPServer(unsigned short port, ITCPHandler* handler);
	~TCPServer();
	bool start();
	void stop();
	unsigned short getPort();
private:
	unsigned short _port;
	ITCPHandler* _handler;
	SOCKADDR_IN _sa;
	SOCKET _listenSocket;
	static void __cdecl _thrProcessConnections(void *arg);
	static void __cdecl _thrConnectionHandler(void *arg);
	void _processConections();
	TCPServer();
};
//
#endif
